<?
require("config.php");

$action = $_POST["action"];
if (NULL!=$action){

$SubScriptCode = $_POST["subscript_code"];
$sessionSubScriptCode = $_SESSION['subscribe_num_check'];
if($SubScriptCode != $sessionSubScriptCode)
{
	echo "<script>alert('Verify code error!');history.back(-1);</script>";
	exit();
}

$Date = date("Y-m-d");


$table = "med_subscription";

   $field = array(
	"email", 
	"name", 
	"date", 
	"last_name",
	"company",
	"branch",
	"profession",
	"address",
	"zip",
	"city",
	"state",
	"country",
	"tel",
	"mobile",
	"lang_english","lang_dannish","lang_chinese",
	);


   $content = array(
	$Email,
	$FirstName,
	date("Y-m-d"),
	$LastName,
	$Company,
	$Branch,
	$Profession,
	$Address,
	$Zip,
	$City,
	$State,
	$Country,
	$Tel,
	$Mobile,
	$lang_english,$lang_dannish, $lang_chinese,
	);

   myInsert($table,$field,$content);





$from_name = $lang['email_from_name'];
$from_email = $lang['email_from_email'];



//Ê¼Í»


$to = $Email;
$to_email = $Email;

$subject = $lang['subscription_subject_c'];

/*$file = "newsletter_subscriber.php?";

$target = 
"Name=" . urlencode($FirstName." ".$LastName) . 
"&Email=" . urlencode($Email) . 
"&Date=" . $Date;


$content =  file($DIR_URL . 'email/' . $file . $target);
for ($i=0;$i<count($content);$i++){
	$content1 .= $content[$i];
}*/

$content1 = "
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>
<head>
<title>Acuity World</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<style type='text/css'>
<!--
body {
	font-family: 'Arial';
	font-size: 12px;
}
-->
</style>
</head>
<body bgcolor='#FFFFFF'>
<table width='600' border='0' cellspacing='0' cellpadding='1'>
  <tr>
    <td align='right'><table width='180' border='0' cellpadding='1' cellspacing='0'>
  <tr>
    <td bgcolor='#000000'><table width='100%' border='0' cellpadding='1' cellspacing='0' bgcolor='#FFFFFF'>
        <tr>
                <td align='center'><font size='3' face='Verdana, Arial, Helvetica, sans-serif'><strong>Acuity World </strong></td>
        </tr>
      </table></td>
  </tr>
</table></td>
  </tr>
</table>
<br>
<br>
Dear $FirstName $LastName, 
<p>Thank you for your subscription to our newsletter.<br>
  <br>
  If you want to learn more for FREE, our <a href='http://www.acuityworld.com/en/learning_zone/' target='_blank'>Learning 
  Zone</a> is the place for you. <br>
  <br>
  For finding your own coach, courses suit you or other value-added services for 
  you, please visit <a href='http://www.acuityworld.com' target='_blank'>www.acuityworld.com</a> 
  <br>
  <br>
  <br>
  Regards,<br>
  <br>
  Webmaster</p>
 
<p>&nbsp; </p>
</body>
</html>
";
sendhtmlmail($from_name,$from_email,$to_name,$to_email,$subject,$content1);


//Ê¼Ô±

$subject = $lang['subscription_subject_a'];


$Query = "select name, email from user_profile where alert05 = 'y'";
$r = myQuery($Query);

for ($i=0;$i<count($r);$i++){
    $to_name  = $r[$i][0];
    $to_email = $r[$i][1];




/*$file = "newsletter_administrator.php?";

$target = 
"Name=" . urlencode($to_name) . 
"&Email=" . urlencode($Email) . 
"&Date=" . $Date;


$content =  file($DIR_URL . 'email/' .$file . $target);

$content1=NULL;
for ($n=0;$n<count($content);$n++){
	$content1 .= $content[$n];
}*/

$Name =  $to_name;
$Content2 = "
<html>
<head>
<title>Acuity World</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<style type='text/css'>
<!--
body {
	font-family: 'Arial';
	font-size: 12px;
}
-->
</style>
</head>
<body bgcolor='#FFFFFF'>
<table width='600' border='0' cellspacing='0' cellpadding='1'>
  <tr>
    <td align='right'><table width='180' border='0' cellpadding='1' cellspacing='0'>
  <tr>
    <td bgcolor='#000000'><table width='100%' border='0' cellpadding='1' cellspacing='0' bgcolor='#FFFFFF'>
        <tr>
                <td align='center'><font size='3' face='Verdana, Arial, Helvetica, sans-serif'><strong>Acuity World </strong></td>
        </tr>
      </table></td>
  </tr>
</table></td>
  </tr>
</table>
<br>
<br>
Dear $Name, 
<p>You have received an newsletter subscription from $Email
  on {$Date}</p>
<p>Email address : $Email</p>
<br>
<a href='http://www.acuityworld.com' target='_blank'>www.acuityworld.com</a>

<p>&nbsp;</p>
 
<p>&nbsp; </p>
</body>
</html>";

sendhtmlmail($from_name,$from_email,$to_name,$to_email,$subject,$Content2);


}


}
?>
<html>
<head>
	<META HTTP-EQUIV="Content-Type" Content="text/html; charset=iso-8859-1">
</head>
<body>
The request is being submitted, please wait...
<form name="SubscriberForm" id="form1" action="http://www.anp.se/processSubscriptionForm.asp"  method="post">
<table border="0" height="150"><tr><td height="29">
</td></tr><tr><td>
<input type="hidden" name="pf_Email" size="30" value="<?=$Email?>"><br>
<input type="hidden" name="pf_AttributeKeyId1" value="20070">
<input type="hidden" name="pf_DemographicField1" size="30" value="<?=$FirstName?>"><br>
<input type="hidden" name="pf_AttributeKeyId2" value="20071">
<input type="hidden" name="pf_DemographicField2" size="30" value="<?=$LastName?>"><br>
<input type="hidden" name="pf_AttributeKeyId3" value="20072">
<input type="hidden" name="pf_DemographicField3" size="30" value="<?=$Company?>"><br>
<input type="hidden" name="pf_AttributeKeyId4" value="20073">
<input type="hidden" name="pf_DemographicField4" size="30" value="<?=$Branch?>"><br>
<input type="hidden" name="pf_AttributeKeyId5" value="20074">
<input type="hidden" name="pf_DemographicField5" size="30" value="<?=$Profession?>"><br>
<input type="hidden" name="pf_AttributeKeyId6" value="20075">
<input type="hidden" name="pf_DemographicField6" size="30" value="<?=$Address?>"><br>
<input type="hidden" name="pf_AttributeKeyId7" value="20076">
<input type="hidden" name="pf_DemographicField7" size="30" value="<?=$Zip?>"><br>
<input type="hidden" name="pf_AttributeKeyId8" value="20077">
<input type="hidden" name="pf_DemographicField8" size="30" value="<?=$City?>"><br>
<input type="hidden" name="pf_AttributeKeyId9" value="20078">
<input type="hidden" name="pf_DemographicField9" size="30" value="<?=$Country?>"><br>
<input type="hidden" name="pf_AttributeKeyId10" value="20079">
<input type="hidden" name="pf_DemographicField10" size="30" value="<?=$Tel?>"><br>
<input type="hidden" name="pf_AttributeKeyId11" value="20080">
<input type="hidden" name="pf_AttributeKeyId12" value="20081">
<input type="hidden" name="pf_DemographicField12" size="30" value="<?=$Mobile?>"><br>
<input type="hidden" name="pf_AttributeKeyId13" value="20082">
<br>
<input type="hidden" name="pf_DeliveryFormat" value="HTML">
</td></tr><tr><td>
<!-- Do not change name or type on submit button, to change visible text, change text for "value" -->
<input type="Submit" name="Submit" id="Submit" value="Tilmeld" style="display:none;">
<!--<input type="hidden" name="Submit" value="Tilmeld">-->
<input type="hidden" name="pf_FormType" value="OptInForm">
<input type="hidden" name="pf_OptInMethod" value="SingleOptInMethod">
<input type="hidden" name="pf_CounterDemogrFields" value="15">
<input type="hidden" name="pf_CounterMailinglists" value="1">
<input type="hidden" name="pf_AccountId" value="5591">
<input type="hidden" name="pf_ListById" value="1">
<input type="hidden" name="pf_Version" value="2">
<input type="hidden" name="pf_CharSet" value="iso-8859-1">
<input type="hidden" name="pf_MailinglistName1" value="115575">
</td></tr></table></form>
<script language="javascript" type="text/javascript">
	window.onload = function (){
	document.getElementById("Submit").click();
	}
</script>
</body>
</html>












